<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.w3.org/1999/xhtml">
    
    <head>
        <meta charset="UTF-8">
        <title>欢迎页面-X-admin2.2</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8" />
        <link rel="stylesheet" th:href="@{/asserts/css/adminfont.css}">
        <link rel="stylesheet" th:href="@{/asserts/css/xadmin.css}">
        <link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" rel="stylesheet" />
        <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
        <script th:src="@{/asserts/lib/layui/layui.js}" charset="utf-8"></script>
        <script th:src="@{/asserts/js/xadmin.js}"  type="text/javascript" ></script>
		<script th:src="@{/asserts/js/admin/attraction_edit.js}"  type="text/javascript" ></script>
        <style type="text/css">
.file {
            position: relative;
            display: inline-block;
            background: #D0EEFF;
            border: 1px solid #99D3F5;
            border-radius: 4px;
            padding: 4px 12px;
            overflow: hidden;
            color: #1E88C7;
            cursor:pointer;
            text-decoration: none;
            text-indent: 0;
            line-height: 20px;
        }
.file input {
    position: absolute;
    font-size: 100px;
    cursor:pointer;
    right: 0;
    top: 0;
    opacity: 0;
			}
.file:hover {
    background: #AADFFD;
    border-color: #78C3F3;
    cursor:pointer;
    color: #004974;
    text-decoration: none;
		}
        

        </style>
        <script type="text/javascript">
      //设置图片
        function setImage() {
            var file = $("#photo").get(0).files[0];
            var reader = new FileReader();
            //创建文件读取相关的变量
            var imgFile;
            //为文件读取成功设置事件
            reader.onload=function(e) {
                imgFile = e.target.result;

                $("#img").attr("src", imgFile);
                console.log("src:"+$("#img").attr('src'));
            };
            reader.readAsDataURL(file);
        }
        </script>
        
    </head>
    <body>
    
        <div class="layui-fluid">
            <div class="layui-row">
                  <div class="layui-form-item">
                      <label for="username" class="layui-form-label">
                          <span class="x-red"></span>父级ID
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="parentId" onblur="exist()" lay-verify="required"
                            value=""         autocomplete="off" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="username" class="layui-form-label">
                          <span class="x-red"></span>景点图片
                      </label>
                      <img   id="img" th:src="@{/asserts/img/common/default_bg.jpg}" alt="" width="120px" height="130px" >
                      <a href="javascript:;" class="file">选择图片
                      <input id="photo" type="file"   onchange="setImage()" accept="image/*" style="margin-top:10px;">
                      </a>
					  
                  </div>
                  <div class="layui-form-item">
                      <label for="phone" class="layui-form-label">
                          <span class="x-red">*</span>名称
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="name" name="name" required="" lay-verify="phone"
                          autocomplete="off" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="L_email" class="layui-form-label">
                          <span class="x-red">*</span>简介
                      </label>
                      <div class="layui-input-inline">
                      	  <textarea id="intro"  style="resize:none;" required lay-verify="required" placeholder="请输入简介" class="layui-textarea"></textarea>
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="L_email" class="layui-form-label">
                          <span class="x-red"></span>电话
                      </label>
                      <div class="layui-input-inline">
                          <input type="tel" id="tel" name="tel" required="" lay-verify="name"
                          autocomplete="off" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="L_email" class="layui-form-label">
                          <span class="x-red"></span>网址
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="web" name="web" required="" lay-verify="name"
                          autocomplete="off" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="L_email" class="layui-form-label">
                          <span class="x-red"></span>用时参考
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="timeReference" name="timeReference" required="" lay-verify="name"
                          autocomplete="off" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="L_email" class="layui-form-label">
                          <span class="x-red"></span>交通
                      </label>
                      <div class="layui-input-inline">
                      <textarea id="tran" style="resize:none;" required lay-verify="required" placeholder="请输入交通方式" class="layui-textarea"></textarea>
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="L_email" class="layui-form-label">
                          <span class="x-red"></span>门票
                      </label>
                      <div class="layui-input-inline">
                      <textarea id="ticket" style="resize:none;" required lay-verify="required" placeholder="请输入门票价格" class="layui-textarea"></textarea>
                          
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="L_email" class="layui-form-label">
                          <span class="x-red"></span>开放时间
                      </label>
                      <div class="layui-input-inline">
                      <textarea id="openTime" style="resize:none;" required lay-verify="required" placeholder="请输入开放时间" class="layui-textarea"></textarea>
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="L_email" class="layui-form-label">
                          <span class="x-red">*</span>位置
                      </label>
                      <div class="layui-input-inline">
                      <textarea id="location" style="resize:none;" required lay-verify="required" placeholder="请输入位置" class="layui-textarea"></textarea>
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="L_email" class="layui-form-label">
                          <span class="x-red">*</span>经度
                      </label>
                      <div class="layui-input-inline">
                      <input type="text" id="longitude" name="parentId" required="" lay-verify="required"
                            value=""         autocomplete="off" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="L_email" class="layui-form-label">
                          <span class="x-red">*</span>纬度
                      </label>
                      <div class="layui-input-inline">
                      <input type="text" id="latitude" name="parentId" required="" lay-verify="required"
                            value=""         autocomplete="off" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="L_repass" class="layui-form-label"></label>
                      <input type="hidden" id="attraction_id" th:value=${id} >
                  	  <input type="hidden" id="attraction_operation" th:value=${operation} >
                  	  
                  	  <div th:switch="${operation}">
                      <div th:case="1">
                      <button  class="layui-btn" onclick="ab03Update('1')" lay-filter="add" lay-submit="">添加</button>
                      </div>
                      <div th:case="2">
                      <button  class="layui-btn" onclick="ab03Update('2')" lay-filter="add" lay-submit="">修改</button>
                      </div>
                      </div>
                  </div>
              		 
            </div>
        </div>
    </body>
   
</html>
